package top.archiesean.id.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.archiesean.id.service.IId;

import java.util.List;
import java.util.Set;

/**
 * @author ArchieSean
 * @description id生成接口
 * @date 2024-01-13 08:26
 */
@RestController
@RequestMapping("id")
@RequiredArgsConstructor
public class IdController {

    private final IId iId;


    /**
     * id生成服务
     *
     * @return id
     */
    @GetMapping
    public Long getId() {
        return iId.getId();
    }

    /**
     * 批量生成id
     *
     * @param num 个数
     * @return set
     */
    @GetMapping("/{num}")
    public List<Long> getId(@PathVariable(name = "num") int num) {
        return iId.getId(num);
    }
}
